<template>
  <el-config-provider :locale="zhCn">
    <div class="app-container">
      <header class="app-header">
        <div class="header-right">
          <UserAvatar />
        </div>
      </header>
      <router-view v-slot="{ Component }">
        <transition name="fade" mode="out-in">
          <component :is="Component" />
        </transition>
      </router-view>
    </div>
  </el-config-provider>
</template>

<script setup>
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import UserAvatar from '@/components/UserAvatar.vue'
</script>

<style>
.app-container {
  min-height: 100vh;
}

.app-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 60px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,21,41,.08);
  z-index: 999;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

#app {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 路由过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>